﻿namespace youtubeFisher
{
	internal enum YouTubeVideoType
	{
		Mobile,
		Flash,
		MP4,
		WebM,
		Unknown
	}
	
	internal class YouTubeVideoFile
	{
		private string _videoUrl;
		public string VideoUrl
		{
			get { return _videoUrl; }
			set { _videoUrl = value; }
		}

		private YouTubeVideoType _videoFormat;
		public YouTubeVideoType VideoFormat
		{
			get { return _videoFormat; }
		}

		private byte _formatCode;
		public byte FormatCode
		{
			get { return _formatCode; }
			set
			{
				_formatCode = value;
				switch (value)
				{
					case 34:
					case 35:
					case 5:
					case 6:
						_videoFormat = YouTubeVideoType.Flash; break;
					case 18:
					case 22:
					case 37:
					case 38:
					case 82:
					case 84:
						_videoFormat = YouTubeVideoType.MP4; break;
					case 13:
					case 17:
						_videoFormat = YouTubeVideoType.Mobile; break;
					case 43:
					case 45:
						_videoFormat = YouTubeVideoType.WebM; break;
					default:
						_videoFormat = YouTubeVideoType.Unknown; break;
				}
			}
		}

		private long videoSize;
		public long VideoSize
		{
			get { return videoSize; }
			set { videoSize = value; }
		}

		public YouTubeVideoFile(string url, byte formatCode)
		{
			_videoUrl = url;
			this.FormatCode = formatCode;
		}
	}
}
